from tkinter import font
import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['svg.fonttype'] = 'none'

# 创建数据框架
data = {
    'Node Nums': [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
    'SPS': [1.799261996,2.732738095,4.426671245,6.857894737,16.216,5.666309524,7.151744663,13.16115196,11.46493902,6.073081464,14.45512821],
    'OGS': [1.970686768,3.717224442,3.945930267,5.152471951,6.268827485,5.992330447,5.744300766,6.87692577,9.357578397,6.380539158,7.279220085],
    'ORDP': [1.540070512,1.857713839,2.130539634,2.480112201,2.514051889,3.133663097,4.928955309,5.19267589,3.960849767,3.886194714,2.676336611],
}

df = pd.DataFrame(data)

# 绘制数据
plt.figure(figsize=(8, 6))
plt.plot(df['Node Nums'], df['SPS'], marker='s', markersize=10, label='SPS')
plt.plot(df['Node Nums'], df['OGS'], marker='^', markersize=10, label='OGS')
plt.plot(df['Node Nums'], df['ORDP'], marker='*', markersize=10, label='ORDP')

# plt.title('Comparison of SPF and Cplex Algorithms')
plt.xlabel('Number of Nodes', fontsize=14)
plt.ylabel('Congestion Ratio', fontsize=14)
plt.legend(fontsize='large')  # 设置图例的字体大小为大

plt.grid(True)
# plt.show()
plt.savefig("plot_incluster_cr.svg", format="svg")
